<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        function fu(){
            var num,a,b;
            num = document.getElementById('ip1');
            num = num.value;
            a = num%2
            if(a==0){
                alert('这是偶数');
            }else{
                alert('这是奇数');
            }
        }
    </script>
</head>
<body>
    请输入一个整数
    <input type="text" id="ip1">
    <button onclick="fu()">判断</button>
</body>
</html>